<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-flight__orderpolicy}">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <el-form-item>
          <el-input v-model="dataForm.id" placeholder="id" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-button @click="getDataList()">{{ $t('query') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button type="info" @click="exportHandle()">{{ $t('export') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button v-if="$hasPermission('flight:orderpolicy:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button v-if="$hasPermission('flight:orderpolicy:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
        </el-form-item>
      </el-form>
      <el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;">
        <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
        <el-table-column prop="id" label="主键" header-align="center" align="center"></el-table-column>
        <el-table-column prop="orderNo" label="订单编号" header-align="center" align="center"></el-table-column>
        <el-table-column prop="airline" label="航空公司二字码" header-align="center" align="center"></el-table-column>
        <el-table-column prop="airlineName" label="航空公司" header-align="center" align="center"></el-table-column>
        <el-table-column prop="applyFlightType" label="适用班期类型" header-align="center" align="center"></el-table-column>
        <el-table-column prop="applyFlightTypeText" label="适用班期类型文本" header-align="center" align="center"></el-table-column>
        <el-table-column prop="cabin" label="舱位" header-align="center" align="center"></el-table-column>
        <el-table-column prop="flightType" label="航程类型 1-单程 2-往返" header-align="center" align="center"></el-table-column>
        <el-table-column prop="keepMoney" label="留钱" header-align="center" align="center"></el-table-column>
        <el-table-column prop="rebate" label="返点" header-align="center" align="center"></el-table-column>
        <el-table-column prop="saleEndDate" label="销售日期结束" header-align="center" align="center"></el-table-column>
        <el-table-column prop="saleStartDate" label="销售日期开始" header-align="center" align="center"></el-table-column>
        <el-table-column prop="snapshotPolicyNo" label="快照政策编号" header-align="center" align="center"></el-table-column>
        <el-table-column prop="snapshotPolicyType" label="政策类型0-私有 1-公布 2-特殊 3-官网" header-align="center" align="center"></el-table-column>
        <el-table-column prop="ticket" label="出票时限方式" header-align="center" align="center"></el-table-column>
        <el-table-column prop="ticketChannels" label="出票方式" header-align="center" align="center"></el-table-column>
        <el-table-column prop="ticketChannelsText" label="出票方式文本" header-align="center" align="center"></el-table-column>
        <el-table-column prop="ticketText" label="出票时限方式文本 1-支付后 2-起飞前" header-align="center" align="center"></el-table-column>
        <el-table-column prop="ticketType" label="票证类型" header-align="center" align="center"></el-table-column>
        <el-table-column prop="timeLimit" label="出票时限" header-align="center" align="center"></el-table-column>
        <el-table-column prop="timeUnit" label="时间单位" header-align="center" align="center"></el-table-column>
        <el-table-column prop="externalPolicyId" label="外部政策id【暂未使用】" header-align="center" align="center"></el-table-column>
        <el-table-column prop="officeNo" label="office 号" header-align="center" align="center"></el-table-column>
        <el-table-column prop="otherContents" label="政策其他说明" header-align="center" align="center"></el-table-column>
        <el-table-column prop="creator" label="创建者" header-align="center" align="center"></el-table-column>
        <el-table-column prop="createDate" label="创建时间" header-align="center" align="center"></el-table-column>
        <el-table-column prop="updator" label="更新人" header-align="center" align="center"></el-table-column>
        <el-table-column prop="updateDate" label="更新时间" header-align="center" align="center"></el-table-column>
        <el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
          <template slot-scope="scope">
            <el-button v-if="$hasPermission('flight:orderpolicy:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>
            <el-button v-if="$hasPermission('flight:orderpolicy:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        :current-page="page"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="limit"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="pageSizeChangeHandle"
        @current-change="pageCurrentChangeHandle">
      </el-pagination>
      <!-- 弹窗, 新增 / 修改 -->
      <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './orderpolicy-add-or-update'
export default {
  mixins: [mixinViewModule],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/flight/orderpolicy/page',
        getDataListIsPage: true,
        exportURL: '/flight/orderpolicy/export',
        deleteURL: '/flight/orderpolicy',
        deleteIsBatch: true
      },
      dataForm: {
        id: ''
      }
    }
  },
  components: {
    AddOrUpdate
  }
}
</script>
